<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>ue-component</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <style>
        body {
            padding-top: 50px;
        }

        .starter-template {
            padding: 40px 15px;
            text-align: center;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="container">
        <navbar></navbar>


        <mainer></mainer>

    </div>
</div>

<script src="./vue.js"></script>

<script>

    //1、创建组件构造器
    const navbar = Vue.extend({
        template: '<nav class="navbar navbar-inverse navbar-fixed-top">\n' +
        '    <div class="container">\n' +
        '        <div class="navbar-header">\n' +
        '            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">\n' +
        '                <span class="sr-only">Toggle navigation</span>\n' +
        '                <span class="icon-bar"></span>\n' +
        '                <span class="icon-bar"></span>\n' +
        '                <span class="icon-bar"></span>\n' +
        '            </button>\n' +
        '            <a class="navbar-brand" href="#">Project name</a>\n' +
        '        </div>\n' +
        '        <div id="navbar" class="collapse navbar-collapse">\n' +
        '            <ul class="nav navbar-nav">\n' +
        '                <li class="active"><a href="#">Home</a></li>\n' +
        '                <li><a href="#about">About</a></li>\n' +
        '                <li><a href="#contact">Contact</a></li>\n' +
        '            </ul>\n' +
        '        </div><!--/.nav-collapse -->\n' +
        '    </div>\n' +
        '</nav>'
    });

    //2、注册组件
    Vue.component('navbar', navbar);


    const mainer = Vue.extend({
        template: '<div class="starter-template">\n' +
        '        <h1>Bootstrap starter template</h1>\n' +
        '        <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>\n' +
        '      </div>'
    });

    const app = new Vue({
        el: '#app',
        data: {},
        methods: {},
        computed: {},
        components: {
            mainer: mainer
        }
    });


</script>

</body>
</html>